Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop rfkill from blocking all radio devices #180

Merged
merged 1 commit into from
Dec 18, 2022
Merged

Stop rfkill from blocking all radio devices #180

merged 1 commit into from
Dec 18, 2022

Conversation

ajanon
Copy link
Collaborator

@ajanon ajanon commented Dec 17, 2022

This fixes a bug introduced in af0115e and closes #174

After creating a uinput device with switches support, all radio devices were blocked. This was due to rfkill reacting to the uinput creation.

We disable rfkill-input (the module reacting to new device creation) to avoid blocking all radio devices. When a new device (virtual or physical) with the SW_RFKILL_ALL switch capability bit set appears, rfkill reacts immediately depending on the value bit. This value bit defaults to unset, which causes rfkill to use its default eop mode (emergency power off). The uinput API does not give any way to set the corresponding value bit before creating the device, and we have no way to avoid rfkill acting upon the device creation or to change its default mode. Thus, we disable rfkill-input temporarily, hopefully fast enough that it won't impact anyone. rfkill-input gets enabled automatically after uinput device creation (actually, when the file gets closed).

This fixes a bug introduced in af0115e.

After creating a uinput device with switches support, all radio devices were
blocked. This was due to rfkill reacting to the uinput creation.

We disable rfkill-input (the module reacting to new device creation) to avoid
blocking all radio devices. When a new device (virtual or physical) with the
SW_RFKILL_ALL switch capability bit set appears, rfkill reacts immediately
depending on the value bit. This value bit defaults to unset, which causes
rfkill to use its default eop mode (emergency power off). The uinput API does
not give any way to set the corresponding value bit before creating the device,
and we have no way to avoid rfkill acting upon the device creation or to change
its default mode. Thus, we disable rfkill-input temporarily, hopefully fast
enough that it won't impact anyone. rfkill-input gets enabled automatically
after uinput device creation (actually, when the file gets closed).
@oneingan
Copy link

It works for me! Thx

@Shinyzenith
Copy link
Member

@ajanon LGTM! Go for the merge!

@ajanon ajanon merged commit 6877854 into main Dec 18, 2022
@ajanon ajanon deleted the rfkill_fix branch December 18, 2022 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

pkexec swhkd turn off the wifi on start
3 participants